package com.erp.purchase.returns.controller;

import com.erp.common.core.controller.BaseController;
import com.erp.common.core.domain.AjaxResult;
import com.erp.common.core.page.TableDataInfo;
import com.erp.purchase.receipts.domain.ErpPurchaseReceipts;
import com.erp.purchase.receipts.mapper.ErpPurchaseReceiptsMapper;
import com.erp.purchase.returns.domain.ErpPurchaseReturns;
import com.erp.purchase.returns.service.ErpPurchaseReturnsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * --- 天道酬勤 ---
 *
 * @author ZhangYuqi
 * @date 2025/9/6
 * @desc
 */
@RestController
@RequestMapping("/purchase/returns")
public class ErpPurchaseReturnsController extends BaseController {
    @Autowired
    private ErpPurchaseReturnsService erpPurchaseReturnsService;
    @GetMapping("/list")
    public TableDataInfo listReturns(ErpPurchaseReturns erpPurchaseReturns) {
        startPage();
        List<ErpPurchaseReturns> list = erpPurchaseReturnsService.selectPurchaseReturnsList(erpPurchaseReturns);
        System.out.println(list);
        System.out.println(getDataTable(list));
        return getDataTable(list);
    }
    @GetMapping("/view/{returnNo}")
    public AjaxResult view(@PathVariable("returnNo") String returnNo) {
        return erpPurchaseReturnsService.selectPurchaseReturnsById(returnNo);
    }
}
